2021 Method
Changes 0
M

PathReinforcement.Create

Description:
Creates a new PathReinforcement object from an array of curves. The newly created object will use a default Rebar Shape.
Remarks:
The method sets Rebar Shape of primary bars only.
Overloads (2):
Create(Document,Element,IList[Curve],Boolean,ElementId,ElementId,ElementId,ElementId)
public static PathReinforcement Create(
	Document document,
	Element hostElement,
	IList<Curve> curveArray,
	bool flip,
	ElementId pathReinforcementTypeId,
	ElementId rebarBarTypeId,
	ElementId startRebarHookTypeId,
	ElementId endRebarHookTypeId
)
  • document
    The document.
  • hostElement
    The element that will host the PathReinforcement. The host can be a Structural Floor, Structural Wall, Structural Slab, or a Part created from a structural layer belonging to one of those element types.
  • IList<Curve>
    curveArray
    An array of curves that will define the outline of the PathReinforcement.
  • Boolean
    flip
    A flag controlling the bars relative to the curves.
  • pathReinforcementTypeId
    The id of the PathReinforcementType.
  • rebarBarTypeId
    The id of the RebarBarType.
  • startRebarHookTypeId
    The id of the RebarHookType for the start of the bar. If this parameter is InvalidElementId, it means to create a rebar with no start hook.
  • endRebarHookTypeId
    The id of the RebarHookType for the end of the bar. If this parameter is InvalidElementId, it means to create a rebar with no end hook.
Return Value PathReinforcement The newly created PathReinforcement.
PathReinforcement CreatePathReinforcement(Autodesk.Revit.DB.Document document, Wall wall)
{
    // Create a geometry line in the selected wall as the path
    List<Curve> curves = new List<Curve>();
    LocationCurve location = wall.Location as LocationCurve;
    XYZ start = location.Curve.GetEndPoint(0);
    XYZ end = location.Curve.GetEndPoint(1);
    curves.Add(Line.CreateBound(start, end));

    // Obtain the default types
    ElementId defaultRebarBarTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.RebarBarType);
    ElementId defaultPathReinforcementTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.PathReinforcementType);
    ElementId defaultHookTypeId = ElementId.InvalidElementId;

    // Begin to create the path reinforcement
    PathReinforcement rein = PathReinforcement.Create(document, wall, curves, true, defaultPathReinforcementTypeId, defaultRebarBarTypeId, defaultHookTypeId, defaultHookTypeId);
    if (null == rein)
    {
        throw new Exception("Create path reinforcement failed.");
    }

    // Give the user some information
    TaskDialog.Show("Revit","Create path reinforcement succeed.");

    return rein;
}
  • The input curveArray is empty. -or- The input curveArray contains at least one helical curve and is not supported for this operation. -or- The element hostElement was not found in the given document. -or- the host Element is not a valid host for Area Reinforcement, Path Reinforcement, Fabric Area or Fabric Sheet. -or- curves in curveArray are not continuous and open. -or- pathReinforcementTypeId should refer to an Path Reinforcement Type element. -or- rebarBarTypeId should refer to an RebarBarType element. -or- startRebarHookTypeId should be invalid or refer to an RebarHookType element. -or- endRebarHookTypeId should be invalid or refer to an RebarHookType element.
  • A non-optional argument was NULL
  • None of the following disciplines is enabled: Structural.
  • This method may not be called during dynamic update.